package com.example.consumer.controller;

import com.example.common.dto.UserDTO;
import com.example.consumer.feign.UserClient;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/consumer")
@RequiredArgsConstructor
public class ConsumerController {

    private final UserClient userClient;

    @GetMapping("/users/{id}")
    public UserDTO getUser(@PathVariable Long id) {
        return userClient.getUser(id);
    }

    @GetMapping("/users")
    public List<UserDTO> getAllUsers() {
        return userClient.getAllUsers();
    }

    @PostMapping("/users")
    public UserDTO createUser(@RequestBody UserDTO user) {
        return userClient.createUser(user);
    }
} 